<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>CCDIKSolver - Three.js Docs</title>
	<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
	<script src="../scripts/highlight.min.js"></script>
	<link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
	<link type="text/css" rel="stylesheet" href="../styles/page.css">
</head>
<body>
	<h1 translate="no">CCDIKSolver</h1>
		<section>
			<header>
				<div class="class-description"><p>This class solves the Inverse Kinematics Problem with a <a href="https://web.archive.org/web/20221206080850/https://sites.google.com/site/auraliusproject/ccd-algorithm" target="_blank" rel="noopener">CCD Algorithm</a>.</p>
<p><code>CCDIKSolver</code> is designed to work with instances of <a href="SkinnedMesh.html">SkinnedMesh</a>.</p></div>
			</header>
			<article>
				<h2 class="subsection-title">Import</h2>
				<p><span translate="no">CCDIKSolver</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
				<pre><code class="language-js">import { CCDIKSolver } from 'three/addons/animation/CCDIKSolver.js';</code></pre>
				<div class="container-overview">
					<h2>Constructor</h2>
					<h3 class="name name-method" id="CCDIKSolver" translate="no">new <a href="#CCDIKSolver">CCDIKSolver</a><span class="signature">( mesh : <span class="param-type"><a href="SkinnedMesh.html">SkinnedMesh</a></span>, iks : <span class="param-type">Array.&lt;<a href="CCDIKSolver.html#~IK">CCDIKSolver~IK</a>></span> )</span> </h3>
					<div class="method">
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>mesh</strong>
									</td>
									<td class="description last">
										<p>The skinned mesh.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>iks</strong>
									</td>
									<td class="description last">
										<p>The IK objects.</p>
										<p>Default is <code>[]</code>.</p>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
				</div>
				<h2 class="subsection-title">Properties</h2>
				<div class="member">
					<h3 class="name" id="iks" translate="no">.<a href="#iks">iks</a><span class="type-signature"> : <a href="SkinnedMesh.html">SkinnedMesh</a></span> </h3>
					<div class="description">
						<p>The IK objects.</p>
					</div>
				</div>
				<div class="member">
					<h3 class="name" id="mesh" translate="no">.<a href="#mesh">mesh</a><span class="type-signature"> : <a href="SkinnedMesh.html">SkinnedMesh</a></span> </h3>
					<div class="description">
						<p>The skinned mesh.</p>
					</div>
				</div>
				<h2 class="subsection-title">Methods</h2>
					<h3 class="name name-method" id="createHelper" translate="no">.<a href="#createHelper">createHelper</a><span class="signature">( sphereSize : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="CCDIKHelper.html">CCDIKHelper</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Creates a helper for visualizing the CCDIK.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>sphereSize</strong>
									</td>
									<td class="description last">
										<p>The sphere size.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> The created helper.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="update" translate="no">.<a href="#update">update</a><span class="signature">( globalBlendFactor : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="CCDIKSolver.html">CCDIKSolver</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Updates all IK bones by solving the CCD algorithm.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>globalBlendFactor</strong>
									</td>
									<td class="description last">
										<p>Blend factor applied if an IK chain doesn't have its own .blendFactor.</p>
										<p>Default is <code>1.0</code>.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
						</dl>
					</div>
					<h3 class="name name-method" id="updateOne" translate="no">.<a href="#updateOne">updateOne</a><span class="signature">( ik : <span class="param-type"><a href="CCDIKSolver.html#~IK">CCDIKSolver~IK</a></span>, overrideBlend : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="CCDIKSolver.html">CCDIKSolver</a></span> </h3>
					<div class="method">
						<div class="description">
							<p>Updates one IK bone solving the CCD algorithm.</p>
						</div>
						<table class="params">
							<tbody>
								<tr>
									<td class="name">
										<strong>ik</strong>
									</td>
									<td class="description last">
										<p>The IK to update.</p>
									</td>
								</tr>
								<tr>
									<td class="name">
										<strong>overrideBlend</strong>
									</td>
									<td class="description last">
										<p>If the IK object does not define <code>blendFactor</code>, this value is used.</p>
										<p>Default is <code>1.0</code>.</p>
									</td>
								</tr>
							</tbody>
						</table>
						<dl class="details">
							<dt class="tag-returns"><strong>Returns:</strong> A reference to this instance.</dt>
						</dl>
					</div>
				<h2 class="subsection-title">Type Definitions</h2>
				<div class="member">
					<h3 class="name" id="~BoneLink" translate="no">.<a href="#~BoneLink">BoneLink</a> </h3>
					<div class="description">
						<p>This type represents bone links.</p>
					</div>
<table class="props">
	<tbody>
		<tr>
				<td class="name">
					<strong>index</strong>
						<br>
<span class="param-type">number</span>
				</td>
			<td class="description last">
				<p>The index of a linked bone which refers to a bone in the <code>Skeleton.bones</code> array.</p>
			</td>
		</tr>
		<tr>
				<td class="name">
					<strong>limitation</strong>
						<br>
<span class="param-type">number</span>
				</td>
			<td class="description last">
				<p>Rotation axis.</p>
			</td>
		</tr>
		<tr>
				<td class="name">
					<strong>rotationMin</strong>
						<br>
<span class="param-type">number</span>
				</td>
			<td class="description last">
				<p>Rotation minimum limit.</p>
			</td>
		</tr>
		<tr>
				<td class="name">
					<strong>rotationMax</strong>
						<br>
<span class="param-type">number</span>
				</td>
			<td class="description last">
				<p>Rotation maximum limit.</p>
			</td>
		</tr>
		<tr>
				<td class="name">
					<strong>enabled</strong>
						<br>
<span class="param-type">boolean</span>
				</td>
			<td class="description last">
				<p>Whether the link is enabled or not.</p>
						<p>Default is <code>true</code>.</p>
			</td>
		</tr>
	</tbody>
</table>
				</div>
				<div class="member">
					<h3 class="name" id="~IK" translate="no">.<a href="#~IK">IK</a> </h3>
					<div class="description">
						<p>This type represents IK configuration objects.</p>
					</div>
<table class="props">
	<tbody>
		<tr>
				<td class="name">
					<strong>target</strong>
						<br>
<span class="param-type">number</span>
				</td>
			<td class="description last">
				<p>The target bone index which refers to a bone in the <code>Skeleton.bones</code> array.</p>
			</td>
		</tr>
		<tr>
				<td class="name">
					<strong>effector</strong>
						<br>
<span class="param-type">number</span>
				</td>
			<td class="description last">
				<p>The effector bone index which refers to a bone in the <code>Skeleton.bones</code> array.</p>
			</td>
		</tr>
		<tr>
				<td class="name">
					<strong>links</strong>
						<br>
<span class="param-type">Array.&lt;<a href="CCDIKSolver.html#~BoneLink">CCDIKSolver~BoneLink</a>></span>
				</td>
			<td class="description last">
				<p>An array of bone links.</p>
			</td>
		</tr>
		<tr>
				<td class="name">
					<strong>iteration</strong>
						<br>
<span class="param-type">number</span>
				</td>
			<td class="description last">
				<p>Iteration number of calculation. Smaller is faster but less precise.</p>
						<p>Default is <code>1</code>.</p>
			</td>
		</tr>
		<tr>
				<td class="name">
					<strong>minAngle</strong>
						<br>
<span class="param-type">number</span>
				</td>
			<td class="description last">
				<p>Minimum rotation angle in a step in radians.</p>
			</td>
		</tr>
		<tr>
				<td class="name">
					<strong>maxAngle</strong>
						<br>
<span class="param-type">number</span>
				</td>
			<td class="description last">
				<p>Minimum rotation angle in a step in radians.</p>
			</td>
		</tr>
		<tr>
				<td class="name">
					<strong>blendFactor</strong>
						<br>
<span class="param-type">number</span>
				</td>
			<td class="description last">
				<p>The blend factor.</p>
			</td>
		</tr>
	</tbody>
</table>
				</div>
				<h2 class="subsection-title">Source</h2>
				<p>
					<a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/animation/CCDIKSolver.js" translate="no" target="_blank" rel="noopener">examples/jsm/animation/CCDIKSolver.js</a>
				</p>
			</article>
		</section>
<script src="../scripts/linenumber.js"></script>
<script src="../scripts/page.js"></script>
</body>
</html>